package com.szakul.pdf;


import javax.annotation.Resource;

import com.szakul.pdf.controller.ViewController;
import com.szakul.pdf.model.TreeModelDao;
import com.szakul.pdf.model.TreeModelDaoImpl;
import com.szakul.pdf.model.ViewModel;
import com.szakul.pdf.spring.context.SpringContextHelper;
import com.vaadin.Application;


import org.apache.log4j.Logger;



public class PdfViewer extends Application{


	public PdfViewer() {
		super();
	}


	/**
     * log4j logger.
     */
    private static final Logger LOGGER = Logger.getLogger(PdfViewer.class);
	
	@Override
	public void init() {

		setTheme("mytheme");
		
		SpringContextHelper helper = new SpringContextHelper(this);
		TreeModelDao treeModelDao = (TreeModelDao) helper.getBean("treeModelDaoViewer");
		
		LOGGER.debug("TreeModelDao passed to init method " + treeModelDao);
		
		ViewModel dataModel = new ViewModel(this, treeModelDao);
		Viewer viewer = new Viewer(dataModel);
		viewer.initWindow();
		
		
		ViewController controller = new ViewController(viewer, dataModel);
		controller.initData();
		
        addWindow(viewer);
        setMainWindow(viewer);
	}


}
